Skip to content

Add Nexus worker service for server-to-worker commands#708

Open
rkannan82 wants to merge 4 commits intokannan/add-worker-instance-key-to-wft-completefrom
kannan/activity-cancel
Open

Add Nexus worker service for server-to-worker commands#708
rkannan82 wants to merge 4 commits intokannan/add-worker-instance-key-to-wft-completefrom
kannan/activity-cancel

Conversation

@rkannan82
Copy link
Contributor

@rkannan82 rkannan82 commented Feb 3, 2026

Summary

Defines a Nexus service for server-to-worker communication, starting with activity cancellation support.

Design Decision

We chose a generic command API (ExecuteCommandsRequest with oneof command types) instead of a cancel-specific API. This allows a future optimization to batch multiple commands (cancel, pause, etc) in a single request and deliver to a worker in one RPC.

Files

  • temporal/api/nexusservices/workerservice/v1/request_response.proto - request response definitions
  • temporal/api/nexusservices/workerservice/v1/service.yaml - Nexus service definition

Related

@rkannan82 rkannan82 requested review from a team as code owners February 3, 2026 21:30
@rkannan82 rkannan82 force-pushed the kannan/activity-cancel branch 3 times, most recently from 4b2e0d1 to 54edb8e Compare February 3, 2026 21:42
@rkannan82 rkannan82 force-pushed the kannan/activity-cancel branch 2 times, most recently from afb40a2 to b920471 Compare February 4, 2026 05:43
@rkannan82 rkannan82 changed the title Add API to send control tasks from server to worker Add Nexus request and response payloads to cancel activities Feb 4, 2026
@rkannan82 rkannan82 requested a review from cretz February 4, 2026 05:50
@rkannan82 rkannan82 force-pushed the kannan/activity-cancel branch from b920471 to 84c0bac Compare February 4, 2026 05:51
@rkannan82 rkannan82 marked this pull request as draft February 4, 2026 05:55
@rkannan82 rkannan82 removed the request for review from ShahabT February 5, 2026 18:05
Copy link
Contributor

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though would want to see end-to-end working including in an SDK if possible before approving

@rkannan82 rkannan82 force-pushed the kannan/activity-cancel branch from 84c0bac to 28ea1dd Compare February 11, 2026 21:20
@rkannan82 rkannan82 changed the base branch from master to kannan/add-worker-instance-key-to-wft-complete February 11, 2026 21:23
@rkannan82 rkannan82 requested review from bergundy and cretz February 12, 2026 18:56
@rkannan82 rkannan82 marked this pull request as ready for review February 12, 2026 19:39
@rkannan82 rkannan82 force-pushed the kannan/activity-cancel branch from 7d3bfb7 to e0d0049 Compare February 12, 2026 19:43
@rkannan82 rkannan82 force-pushed the kannan/add-worker-instance-key-to-wft-complete branch from 61952c9 to 98350a9 Compare February 12, 2026 19:46
@rkannan82 rkannan82 force-pushed the kannan/activity-cancel branch from e0d0049 to 6c21af4 Compare February 12, 2026 19:47
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, don't merge this until you've generated the code and verified that this API works across SDK and server.

There will probably be a separate code generation project that will construct the YAML from protos to prevent the need to define services in separate places but this is a good start IMHO.

Copy link
Contributor

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is our first Nexus service, so lots of things undecided. I added comments, but would like to hear others' opinions.

@rkannan82 rkannan82 force-pushed the kannan/activity-cancel branch from 6c21af4 to 37ffb33 Compare February 25, 2026 19:01
@rkannan82 rkannan82 force-pushed the kannan/activity-cancel branch from 37ffb33 to 6c21af4 Compare February 27, 2026 22:19
@rkannan82 rkannan82 changed the title Add Nexus request and response payloads to cancel activities Add Nexus worker service for server-to-worker commands Feb 27, 2026
@rkannan82 rkannan82 requested a review from bergundy February 27, 2026 22:56
message WorkerCommandsRequest {
repeated WorkerCommand commands = 1;

message WorkerCommand {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would pull this out to a top level message and put it in temporal.api.worker.v1 to make it easier to use and available in other contexts, traditionally we have only put requests and responses in request_response.proto files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But since this is a new nexus service, shouldn't this be decoupled from the existing gRPC temporal.api.worker.v1 protos and exist in the separate temporal/api/nexusservices? Maybe temporal.api.nexusservices.worker.v1?

Do we know what other contexts we might want to use this message, or is that hypothetical?

Copy link
Contributor Author

@rkannan82 rkannan82 Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the changes that Roey suggested. Here is my interpretation.

  • Top level request/response is about the RPC. In this case, it is nexus protocol. So we keep it under nexusservices dir.
  • WorkerCommand is not strictly tied to this protocol. So we move it out of nexusservices dir.
    -As to whether this is useful in other places: I am not sure. We could repurpose these command protos in the server side when we create the internal tasks. But it is not good to couple them.

@rkannan82 rkannan82 force-pushed the kannan/activity-cancel branch from 32523fb to cfff488 Compare March 13, 2026 18:09
- Rename WorkerCommandsRequest/Response to ExecuteCommandsRequest/Response
  to match the operation name (bergundy feedback)
- Change operation name from executeCommands to ExecuteCommands (PascalCase)
- Add doc: results list must be 1:1 with commands list (Sushisource feedback)

Made-with: Cursor
Move WorkerCommand, CancelActivityCommand, WorkerCommandResult, and
CancelActivityResult to temporal.api.worker.v1 as top-level messages.
request_response.proto now only contains ExecuteCommandsRequest and
ExecuteCommandsResponse, following the repo convention. (bergundy feedback)

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants